package org.txazo.blog.web.interceptor;

import org.txazo.blog.web.exception.GlobalException;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 异常包装拦截器
 * 
 * @author Tu XiaoZhou
 * @since 2013-08-10
 * 
 */
public class ExceptionInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws GlobalException {
		String result = null;
		try {
			result = invocation.invoke();
		} catch (Exception e) {
			/** 抛出包装的GlobalException异常 */
			throw new GlobalException(e);
		}

		return result;
	}

}
